<?
$title = "Welcome";
require("required/dbconnect.php");
$_SESSION['pid'] = "home";
require("required/share_function.php");
require("required/function.php");
require("required/header.php");
?>
<table width="100%" height="100%" bgcolor="#666699">
    <tr>
        <Td width="60%" style="padding-left:120px">

            <?
            $get_featured = mysql_query("select * from os_products where status=1 and featured=1 order by id desc limit 1") or die(mysql_error());

            if (mysql_num_rows($get_featured) > 0) {
                ?>
                <table width="100%">
                    <tr>
                        <Td colspan="2"><img src='images/buttons/featured.png'/>
                            <br><br>
                        </Td>
                    </tr>
                    <?
                    $f = mysql_fetch_array($get_featured, MYSQL_ASSOC);

                    $get_pic = mysql_query("select * from os_productpic where product_id=" . $f['id'] . " order by order_id asc limit 1") or die(mysql_error());

                    if (mysql_num_rows($get_pic) == 0) {
                        $pic = "empty";
                        $piclink = "noimage.jpg";
                        $fix = "";
                    } else {
                        $pic = mysql_fetch_array($get_pic, MYSQL_ASSOC);

                        $piclink = $pic['name'];

                        if ($pic["width"] - $pic["height"] > 0) {
                            $fix = "width=180";
                        } else {
                            $fix = "height=130";
                        }
                    }

                    $product_url = getProductUrl($f['id'], $f['clean_url'], $module_url_rewrite);
                    ?>
                    <td width="40%" valign="top">
                        <a href='<?= $product_url ?>'><img  border=0 src='productpic/thumbnails/<?= $piclink ?>' <?= $fix ?> ></a>
                    </td>
                    <td align="left" valign="top">

                        <font style="color:#bfdfe0;font-size:20px;font-weight:bold"><?= $f['product_name_eng'] ?></font>



                        <font color="#FFFFFF"><?= truncate($f['description_eng']) ?></font>
                        <br /><br />
                        <div><a href='<?= $product_url ?>'>
                                <img src="images/buttons/view_more.png" border="0"/></a></div>
                    </td>

                </table>
            <? } ?>
        </Td>
        <td valign="top" style="padding-right:120px">
            <table align="right" id="Table_01" border="0" cellpadding="0" cellspacing="0" class="table_dark_grey" width="300">
                <tr>
                    <Td>				
                        <?
                        $get_announcement = mysql_query("select * from os_announcement where status=1 order by create_date desc limit 3") or die(mysql_error());

                        if (mysql_num_rows($get_announcement) > 0) {
                            ?>
                            <img src="images/individual_images/news_events_title.png">

                            <table border='0' width="100%" cellpadding="6">
                                <?
                                while ($info = mysql_fetch_array($get_announcement)) {
                                    ?>
                                    <tr>
                                        <Td valign="top"><img id='btn<?= $info['id'] ?>' src='images/individual_images/button.png'></Td>
                                        <td>
                                            <font style='font-size:16px' color='#ffffff'><?= $info['create_date'] ?></font>
                                            <br />
                                            <a href='os_announcement_view_full.php?id=<?= $info['id'] ?>' onmouseover="document.getElementById('btn<?= $info['id'] ?>').src='images/individual_images/redlight.png'"
                                               onmouseout="document.getElementById('btn<?= $info['id'] ?>').src='images/individual_images/button.png'">
                                                <font style='font-size:12px' color='#ffffff'><?= $info['title'] ?></font></a>

                                        </td> 
                                    </tr>



                                    <?
                                }
                                ?>
                            </table>
                            <?
                        }
                        ?>

                    </td>
                </tr>
            </table>

        </Td>
    </tr>
    <tr>
        <Td colspan="2" style="background:url(images/main_banner_bottom.jpg);" height="10">
        
        </td>
    </tr>

</table>

<table width="100%" align="left" cellpadding="5" >
    <tr>

    </tr>
    <tr>
        <td style="padding-left:120px;padding-right:110px">
            <table width="100%" >
                <td  ><img src="images/individual_images/latest_products.png" /></td>
                <?
                $get_product = mysql_query("select * from os_products where status=1 and show_at_latest=1 order by id desc limit 5") or die(mysql_error());

                $tr1 = "";
                $tr2 = "";
                if (mysql_num_rows($get_product) == 0) {
                    ?>
                    <tr>
                        <td align="center" class='content_white'> :: COMING SOON :: </td>
                    </tr>
                    <?
                } else {
                    latestProductList($get_product);
                }
                ?>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            
        </td>
    </tr>

</table>       
<?
require("required/footer.php");
?>
	
